import _ from 'lodash';
import * as api from '@/services/ReturnMoneyPlanMgr';

const Model = {
  namespace: 'ReturnMoneyPlanApproveMobile',
  state: {
    item: {},
  },
  effects: {
    // 基本信息
    *info({ payload, callback }, { call, put }) {
      // const response = yield call(api.approvalPreviewMobileUsingGET, payload);
      const response = yield call(api.approvalPreviewAppUsingGET, payload);
      if (response && response.code === 1) {
        const item = response.data;
        yield put({
          type: 'save',
          payload: { item },
        });
      }
      if (callback) callback(response);
    },
  },
  reducers: {
    save(state, action) {
      return {
        ...state,
        ...action.payload,
      };
    },
  },
};

export default Model;
